Intro

Show dynamic markdown content in toddle

This package lets you render dynamic markdown content from headless CMSs like Storyblock, Contentful, and other in toddle.

Demo

Components

  • markdown-block

    This is the only component in this package. Use the markdown attribute to show your markdown content.

    Attributes

    markdownThe markdown content to show

Style variables

The following style variables can be used to customize the styling of the editor content. Add these to your project theme or as component style variables to override the default values.

markdown-block-font-colorThe default font color
markdown-block-bg-colorThe default background color
markdown-block-font-sizeThe default font size
markdown-block-h1-sizeHeading 1 font size
markdown-block-h1-colorHeading 1 font color
markdown-block-h2-sizeHeading 2 font size
markdown-block-h2-colorHeading 2 font color
markdown-block-link-colorHyperlink color
markdown-block-strong-color<strong> font color
markdown-block-quote-colorBlockquote font color
markdown-block-quote-border-colorBlockquote border color

Disclaimer

  • markdown-block uses the "on Load" event and as a result will not be rendered on the server initally.  This means that the markdown-block element will be empty on the initial server render, and then filled out as soon as the page is loaded in the browser.

Credits

  • This package uses the excellent Marked library for converting Markdown to HTML.

    It also uses dompurify for removing any potentially harmful tags from the HTML output.